// 模块

import Vue from 'vue'
import VueRouter from 'vue-router'

// Vue使用路由插件
Vue.use(VueRouter)

// 实例化router
// 导入要渲染的组件
import AppList from '../components/hero/AppList.vue'
import Bar from '../components/equip/Bar.vue'
import Foo from '../components/weap/Foo.vue'
import Add from '../components/hero/Add.vue'
import Edit from '../components/hero/Edit.vue'

const router = new VueRouter({
    // 全局设置样式
    linkExactActiveClass: 'active',
    routes: [{
        path: '/',
        // component: AppList
        redirect: '/list'
    }, {
        path: '/list',
        component: AppList
    }, {
        path: '/bar',
        component: Bar
    }, {
        path: '/foo',
        component: Foo
    }, {
        path: '/add',
        component: Add
    }, {
        // edit/2
        // edit/3
        path: '/edit/:id',
        component: Edit
    }]
})

// 导出
export default router